{% macro render_pagination(pagination, url_route) %}
    <!--pagination为分页数据，url为指定分页的路由，需要给路由带上page参数，指定页数-->
    <ul class="pagination pagination-sm no-margin pull-right">
        <li><a href="{{ url_for(url_route, page=1) }}">首页</a></li>

        {% if pagination.has_prev %}
            <li><a href="{{ url_for(url_route, page=pagination.prev_num) }}">上一页</a></li>
        {% endif %}

        {% for page in pagination.iter_pages() %}
            {% if page %}
                {% if page != pagination.page %}
                    <li><a href="{{ url_for(url_route, page=page) }}">{{ page }}</a></li>
                {% else %}
                    <li class="active"><a>{{ page }}</a></li>
                {% endif %}
            {% endif %}
        {% endfor %}

        {% if pagination.has_next %}
            <li><a href="{{ url_for(url_route, page=pagination.next_num) }}">下一页</a></li>
        {% endif %}

        <li><a href="{{ url_for(url_route, page=pagination.pages) }}">尾页</a></li>
    </ul>
{% endmacro %}